﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using TMDT_Nhom1A.BUS;

namespace TMDT_Nhom1A.Customer
{
    public partial class ThanhToan_Buoc2_XacNhan : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //Session["Step"] = 1;
                
                if (Session["Step"].ToString() == "1")
                {
                    string orderB2BID = "";
                    if (Request.QueryString["MaXacNhan"] != "" && Request.QueryString["MaXacNhan"] != null)
                    {
                        orderB2BID = Request.QueryString["MaXacNhan"];
                        //kiem tra ma xac nhan(orderB2B_ID) trong bang orderB2B có ton tai ko
                        bool isExist = OrderB2B_BUS.checkExistOrderB2BID(orderB2BID);
                        if (isExist == true)
                        {
                            Success.Visible = true;
                            failure.Visible = false;
                            ThongBao.Visible = false;
                            btNext.Visible = true;
                            Session["Step"] = 2;
                        }
                        else
                        {
                            Success.Visible = false;
                            failure.Visible = true;
                            ThongBao.Visible = false;
                        }
                    }
                    else
                    {
                        ThongBao.Visible = false;
                        failure.Visible = true;
                        Success.Visible = false;
                    }
                }
                else
                {
                    ThongBao.Visible = true;
                    failure.Visible = false;
                    Success.Visible = false;
                }
            }
        }

        protected void btNext_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Customer/ThanhToan_Buoc3_ChonVanChuyen.aspx");
        }
    }
}
